#pragma once
#include <stdio.h>
#include <iostream>
#include <memory>

using namespace std;

//备忘录Memento
class Memento{
public:
	Memento(string account,string password,string telNo){
		this->account = account;
		this->password =password;
		this->telNo = telNo;
	}
	
	string getAccount(){
		return account;
	}
	
	void setAccount(string account){
		this->account = account;
	}
	
	string getPassword(){
		return password;
	}
	
	void setPassword(string password){
		this->password = password;
	}
	
	string getTelNo(){
		return telNo;
	}
	
	void setTelNo(string telNo){
		this->telNo = telNo;
	}
private: 
	string account;
	string password;
	string telNo;
};

//原发器UserInfoDTO(用户信息类)
class UserInfoDTO{
public:
	string getAccount(){
		return account;
	}
	
	void setAccount(string account){
		this->account = account;
	}
	
	string getPassword(){
		return password;
	}
	
	void setPassword(string password){
		this->password = password;
	}
	
	string getTelNo(){
		return telNo;
	}
	
	void setTelNo(string telNo){
		this->telNo = telNo;
	}
	
	Memento* saveMemento(){
		return new Memento(account,password,telNo);
	}
	
	void restoreMemento(Memento* memento){
		this->account = memento->getAccount();
		this->password = memento->getPassword();
		this->telNo = memento->getTelNo();
	}
	
	void show(){
		cout << "Account:" << this->account << endl << "Password:" << this->password << endl
		<< "TelNo:" << this->telNo << endl;
	}
	
private:
	string account;
	string password;
	string telNo;
}; 


//负责人Caretaker
class Caretaker{
public:
	Caretaker(){
		
	}
	Memento* getMemento(){
		return memento.get();
	}
	
	void setMemento(Memento *memento){
		this->memento.reset(memento);
	}
private:
	shared_ptr<Memento> memento;
}; 